<% if false # the license inside this if block pertains to this file -%>
  # Copyright 2017 Google Inc.
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
<% end -%>
<% if tf_types.include?(property.class) -%>
<%   optional, computed, forcenew = optional_compute_forcenew?(property, object) -%>
"<%= property.out_name -%>": {
    Type: <%= tf_types[property.class] %>,
<%   if property.required -%>
        Required: true,
<%   end -%>
<%   if computed -%>
        Computed: true,
<%   end -%>
<%   if optional -%>
        Optional: true,
<%   end -%>
<%   if forcenew -%>
        ForceNew: true,
<%   end -%>
<%   unless property.validation.nil? -%>
<%     if !property.validation.regex.nil? -%>
        ValidateFunc: validateRegexp(`<%= property.validation.regex -%>`),
<%     elsif !property.validation.function.nil? -%>
        ValidateFunc: <%= property.validation.function -%>,
<%     end # property.validation.nil?  -%>
<%   end # property.validation.nil?  -%>
<%   if property.is_a?(Api::Type::Enum) && property.validation.nil?
       enum_values = property.values
       enum_values.push "" unless property.required
-%>
    <% #ValidateFunc: validation.StringInSlice([]string{"<%= enum_values.join '","' -%><% #"}, false),-%>
<%   end -%>
<%   if !property.diff_suppress_func.nil? -%>
        DiffSuppressFunc: <%= property.diff_suppress_func %>,
<%   elsif property.is_a?(Api::Type::ResourceRef) -%>
        DiffSuppressFunc: compareSelfLinkOrResourceName,
<%   end -%>
<%   unless property.state_func.nil? -%>
        StateFunc: <%= property.state_func %>,
<%   end -%>
<%   if property.is_a?(Api::Type::NestedObject) -%>
        MaxItems: 1,
        Elem: &schema.Resource{
            Schema: map[string]*schema.Schema{
<%     order_properties(property.properties).each do |prop| -%>
        <%= lines(build_schema_property(prop, object)) -%>
<%     end -%>
            },
        },
<%   elsif property.is_a?(Api::Type::Array) -%>
<%     unless property.max_size.nil? -%>
        MaxItems: <%= property.max_size %>,
<%     end -%>
<%     if property.item_type.is_a?(Api::Type::NestedObject) -%>
        Elem: &schema.Resource{
            Schema: map[string]*schema.Schema{
<%       order_properties(property.item_type.properties).each do |prop| -%>
            <%= lines(build_schema_property(prop, object)) -%>
<%       end -%>
            },
        },
<%     elsif property.item_type.is_a?(String) # Basic type like Api::Type::String -%>
        Elem: &schema.Schema{
            Type: <%= tf_types[property.item_type] -%>,
<%       if property.item_type.is_a?(Api::Type::ResourceRef) -%>
            DiffSuppressFunc: compareSelfLinkOrResourceName,
<%       end -%>
        },
<%     else # array of basic types -%>
        Elem: &schema.Schema{
            Type: <%= tf_types[property.item_type.class] -%>,
<%       if property.item_type.is_a?(Api::Type::ResourceRef) -%>
            DiffSuppressFunc: compareSelfLinkOrResourceName,
<%       end -%>
        },
<%     end -%>
<%   elsif property.is_a?(Api::Type::NameValues) -%>
        Elem: &schema.Schema{Type: schema.TypeString},
<%     if not (property.key_type == 'Api::Type::String' and property.value_type == 'Api::Type::String') -%>
    // TODO(magic-modules): Handle this map specially - Terraform maps are String->String only,
    // but this map is marked as being <%= property.key_type -%>-><%= property.value_type -%>.
<%     end -%>
<%   end -%>
<%   if property.sensitive -%>
        Sensitive: true,
<%   end -%>
<%   unless property.default.nil? -%>
        Default: <%= go_literal(property.default) %>,
<%   end -%>
},
<% else -%>
  // TODO: Property '<%= property.name -%>' of type <%= property.class -%> is not supported
<% end # tf_types.include?(property.class) -%>
